package com.item.service.impl;

import com.github.pagehelper.PageHelper;
import com.item.domain.TabList;
import com.item.mapper.TabListMapper;
import com.item.service.TabListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TabListServiceImpl implements TabListService {

    @Autowired
    TabListMapper tabListMapper;


    public List<TabList> findAll(int limit, int page, TabList tabList) {
        if (limit > 0 && page > 0) {
            PageHelper.startPage(limit, page);
        }
        return tabListMapper.findAll(tabList);
    }


    public int add(TabList tabList) {

        return tabListMapper.insertSelective(tabList);
    }


    public int update(TabList tabList) {
        return tabListMapper.updateByPrimaryKey(tabList);
    }

    @Override
    public int delete(int id) {
        return tabListMapper.deleteByPrimaryKey(id);
    }
}
